<?php
namespace Admin\Controller;
use Common\Controller\AdminBaseController;

/**
 * 订单管理 - 控制器
 */
class OrderController extends AdminBaseController{
	/**
	 * 订单管理 - 首页
	 */
	public function index(){

		$total_page = $this->total_page;

		$data = D('Order')->index($total_page);

		$this->assign($data);

		$this->display();
	}

	/**
	 * 修改订单状态
	 */
	public function order_status(){

		$data = D('Order')->order_status();

		$this->ajaxReturn($data);

	}

	/**
	 * 批量删除订单
	 */
	public function order_del(){

		$data = D('Order')->order_del();

		$this->ajaxReturn($data);

	}

	/**
	 * 获取订单 - 备注信息
	 */
	public function order_remarks(){

		$data = D('Order')->order_remarks();

		$this->ajaxReturn($data);

	}

	/**
	 * 更新订单 - 备注信息
	 */
	public function update_remarks(){

		$data = D('Order')->update_remarks();

		$this->ajaxReturn($data);

	}


	/**
	 * 获取订单数据
	 */
	public function order_data(){

		$data = D('Order')->order_data();

		$this->ajaxReturn($data);

	}

	/**
	 * 编辑保存订单
	 */
	public function edit_save(){

		$data = D('Order')->edit_save();

		$this->ajaxReturn($data);
	}

	/**
	 * 新增订单
	 */
	public function add_order(){

		$data = D('Order')->add_order();

		$this->ajaxReturn($data);

	}

	/**
	 * 下载订单XLS 表格
	 */
	public function download_xls(){

		$data = D('Order')->download_xls();

		$filename = "订单列表".date("Y-m-d",time())."xls";

		array_unshift($data,array('订单ID','页面名称','套餐明细','数量','套餐单价','总价','姓名','手机号码','省','市','地区','收件地址','下单IP','下单时间','订单状态','快递公司','快递单号','留言','备注','详情URL'));

		create_xls($data,$filename);

	}

	/**
	 * 订单 - 批量发货
	 */
	public function import_excel(){

		$data = D('Order')->import_excel();

		$this->ajaxReturn($data);

	}


}
